/*
 * =====================================================================================
 *
 *       Filename:  18-deleteDupKeys.cpp
 *
 *    Description:  删除单链表重复值
 *
 *        Version:  1.0
 *        Created:  2011-11-1 16:39:33
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  YOUR NAME (),
 *        Company:
 *
 * =====================================================================================
 */

#include "ListProblem.h"
#include <ctime>
#include <iostream>

#define LARGE_COUNT 100000

int main(int argc, char *argv[])
{
    std::cout << "the max random count is " << LARGE_COUNT << std::endl;
    clock_t start, finish;
    {
        ListNode<int> *head = createRandList<int>(LARGE_COUNT);

        start = clock();
        head = deleteDupKeys(head);
        finish = clock();
        std::cout << "deleteDupKeys running time is "
                  << (finish - start) / CLOCKS_PER_SEC
                  << " seconds"
                  << std::endl;

        deleteList(head);
    }
    {
        ListNode<int> *head = createRandList<int>(LARGE_COUNT);

        start = clock();
        head = deleteDupKeysUseSort(head);
        finish = clock();
        std::cout << "deleteDupKeysUseSort running time is "
                  << (finish - start) / CLOCKS_PER_SEC
                  << " seconds"
                  << std::endl;

        deleteList(head);
    }
}
